/*
 * ExactDiag.h
 *
 *  Created on: Oct 9, 2012
 *      Author: snirgaz
 */

#ifndef EXACTDIAG_H_
#define EXACTDIAG_H_

#include <iostream>
#include <vector>
#include <boost/dynamic_bitset.hpp>
#include <boost/array.hpp>
#include "boost/lexical_cast.hpp"
#include <Eigen/Dense>
#include "hdf5RW.h"
#include <Eigen/Core>
#include "mathimf.h"
#include <boost/math/constants/constants.hpp>
#include <boost/filesystem.hpp>

using namespace Eigen;
using namespace std;
using namespace boost;

vector<int> mzStates(int L, int mz);

struct EigenSys {
	VectorXd eigVal;
	MatrixXd eigVec;
};

class ExactDiag {
	MatrixXd H_;
	double alpha_;
	int L_, numOfmzStates_, mz_;
	vector<int> mzStates_;
	string outPath_, inPath_;
	VectorXd corr_;
	EigenSys eigenState;
public:
	void init(int L, double alpha);
	void constructH();
	void diag();
	void diagAll();
};

class LFCorr {
	MatrixXd HLF_;
	int L_, numOfmzStates_, mz_;
	vector<int> mzStates_;
	string inPath_, outPath_;
	EigenSys eigensys_;
	double Z_;
	VectorXd corr_;
	double beta_;
	int maxOmega_;
public:
	void init(int L, double beta, int maxOmega, double alpha);
	void readData(int mz);
	void constructHLF();
	void CalcHLFCorr(bool sym);
	void calcAll();
};

class EnergyMeasure {
	int L_, numOfmzStates_, mz_;
	vector<int> mzStates_;
	string inPath_, outPath_;
	EigenSys eigensys_;
	double Z_;
	double energy_;
	double beta_;
public:
	void init(int L, double beta, double alpha);
	void readData(int mz);
	void CalcEnergy(bool sym);
	void calcAll();
};

class SteggeredMagnetizationMeasure {
	int L_, numOfmzStates_, mz_;
	vector<int> mzStates_;
	string inPath_, outPath_;
	EigenSys eigensys_;
	double Z_;
	double mag_;
	double beta_;
public:
	void init(int L, double beta);
	void readData(int mz);
	void CalcEnergy(bool sym);
	void calcAll();
};

#endif /* EXACTDIAG_H_ */
